﻿<Window x:Class="IS_Ever_Green.View.LoginView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:IS_Ever_Green.View"
        xmlns:viewModel="clr-namespace:IS_Ever_Green.ViewModel" 
        xmlns:customcontrols="clr-namespace:IS_Ever_Green.CustomControls"
        mc:Ignorable="d"
        Height="1024" Width="1440"
        WindowStyle="None"
        ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen"
        MouseDown="Window_MouseDown"
        Background="Transparent"
        AllowsTransparency="True"
        >

    <Window.DataContext>
        <viewModel:LoginViewModel/>
    </Window.DataContext>

    <Border CornerRadius="16">

        <Border.Background>
            <ImageBrush ImageSource="/Images/background.png"/>
        </Border.Background>

        <Border CornerRadius="16"
            BorderThickness="5"
            >

            <Border.BorderBrush>
                <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                    <GradientStop Color="{StaticResource winBorderColor1}" Offset="0.0"/>
                    <GradientStop Color="{StaticResource winBorderColor2}" Offset="0.5"/>
                    <GradientStop Color="{StaticResource winBorderColor3}" Offset="1.0"/>
                </LinearGradientBrush>
            </Border.BorderBrush>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="75"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="20"/>
                        <ColumnDefinition Width="40"/>
                        <ColumnDefinition Width="40"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Button x:Name="btnClose" 
                            BorderThickness="0"
                            Content="X"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="16"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="1"
                            Click="btnClose_Click"
                            >

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/> 
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="30" Height="30"
                                        CornerRadius="15"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                                    HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>

                    <Button x:Name="btnMinimize" 
                            BorderThickness="0"
                            Content="-"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="25"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="2"
                            Click="btnMinimize_Click"
                            >

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource secondaryButtonColor}"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource secondaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="30" Height="30" 
                                        CornerRadius="15"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                                    HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>

                </Grid>

                <Border Width="500"
                        Height="650"
                        Grid.Row="2"
                        Background="#fff"
                        CornerRadius="16"
                        >

                    <Border.Effect>
                        <DropShadowEffect ShadowDepth="5" Color="#000000" Opacity="0.2" BlurRadius="20"/>
                    </Border.Effect>

                    <StackPanel Orientation="Vertical"
                                Margin="20">

                    <Button x:Name="btnBack" 
                            BorderThickness="0"
                            Content="&lt;"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="25"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="1"
                            HorizontalAlignment="Left"
                            Click="btnBack_Click"
                            >

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource secondaryButtonColor}"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource secondaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="30" Height="30"
                                        CornerRadius="15"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                                    HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>

                    <TextBlock Text="Вход" 
                                Foreground="{StaticResource primaryTextColor}"
                                Grid.Column="1" 
                                HorizontalAlignment="Center"
                                FontSize="25"
                                FontFamily="Montserrat"
                                />

                    <Image Source="/Images/LogoName.png" Width="250" Height="90"/>

                    <TextBlock Text="Ever Green"
                               Foreground="{StaticResource secondaryTextColor}"
                               FontSize="35"
                               FontWeight="Medium"
                               FontFamily="Montserrat"
                               HorizontalAlignment="Center"
                               />



                    <TextBlock Text="login" 
                               Foreground="{StaticResource primaryTextColor}"
                               FontSize="20"
                               FontWeight="Medium"
                               FontFamily="Montserrat"
                               Margin="0 40 0 0"
                               />

                    <TextBox Text="{Binding Login, UpdateSourceTrigger = PropertyChanged}"
                             Foreground="{StaticResource primaryTextColor}"
                             FontSize="25"
                             FontWeight="Medium"
                             FontFamily="Montserrat"
                             CaretBrush="{StaticResource markerColor}"
                             BorderBrush="{StaticResource primaryTextColor}"
                             BorderThickness="0 0 0 1"
                             Height="35"
                             VerticalContentAlignment="Center"
                             Margin="0 5 0 0"
                             Padding="30 0 0 0"
                             >

                        <TextBox.Background>
                            <ImageBrush ImageSource="/Images/User/Login.png"
                                        Stretch="none"
                                        AlignmentX="Left"
                                        />
                        </TextBox.Background>
                    </TextBox>



                    <TextBlock  Text="Password"
                                Foreground="{StaticResource primaryTextColor}"
                                FontSize="20"
                                FontWeight="Medium"
                                FontFamily="Montserrat"
                                Margin="0 40 0 0"
                                />

                    <customcontrols:BindablePassword Password="{Binding Password, Mode=TwoWay ,UpdateSourceTrigger = PropertyChanged}"
                                     Height="35"
                                     Margin="0 5 0 0"
                                     >
                    </customcontrols:BindablePassword>

                    <TextBlock  Text="{Binding ErrorMessage}"
                                Foreground="{StaticResource errorMessage}"
                                FontSize="20"
                                FontWeight="Medium"
                                FontFamily="Montserrat"
                                Margin="0 10 0 0"
                                TextWrapping="Wrap"
                                />

                    <Button Command="{Binding LoginCommand}"
                            BorderThickness="0"
                            Content="Войти в систему"
                            Foreground="{StaticResource secondaryTextColor}"
                            FontSize="16"
                            FontFamily="Montserrat"
                            Cursor="Hand"
                            Grid.Column="1"
                            Margin="0 50 0 0"
                            >

                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="{StaticResource primaryButtonColor}"/>
                                <Style.Triggers>
                                    <Trigger Property="IsMouseOver" Value="True">
                                        <Setter Property="Background" Value="{StaticResource primaryButtonHoverColor}"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>

                        <Button.Template>
                            <ControlTemplate TargetType="Button">
                                <Border Width="390" Height="50"
                                        CornerRadius="16"
                                        Background="{TemplateBinding Background}">

                                    <ContentPresenter VerticalAlignment="Center"
                                                      HorizontalAlignment="Center"/>

                                </Border>
                            </ControlTemplate>
                        </Button.Template>

                    </Button>

                    <StackPanel Orientation="Horizontal"
                                HorizontalAlignment="Center"
                                Margin="0 15 0 0"
                                >

                        <TextBlock Text="Забыли пароль?"
                                   Foreground="{StaticResource primaryTextColor}"
                                   FontSize="18"
                                   FontWeight="Medium"
                                   FontFamily="Montserrat"
                                   />

                        <Button Command="{Binding OpenModalRecoverPassword}"
                                Content="Восстановить"
                                Foreground="{StaticResource primaryTextColor}"
                                FontSize="18"
                                FontWeight="Medium"
                                FontFamily="Montserrat"
                                Cursor="Hand"
                                Margin="8 0 0 0"
                                BorderThickness="0"
                                >

                            <Button.Style>
                                <Style TargetType="Button">
                                    <Setter Property="Background" Value="Transparent"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="Background" Value="Transparent"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </Button.Style>

                            <Button.Template>
                                <ControlTemplate TargetType="Button">
                                    <Border CornerRadius="15"
                                            Background="{TemplateBinding Background}">

                                        <ContentPresenter VerticalAlignment="Center"
                                                          HorizontalAlignment="Center"/>

                                    </Border>
                                </ControlTemplate>
                            </Button.Template>
                        </Button>
                        
                    </StackPanel>

                </StackPanel>
                    
                </Border>

                <ContentControl Width="650" 
                            Height="800" 
                            Grid.Row="1" 
                            Content="{Binding RecoveryPassword}"
                            Visibility="{Binding RecoveryPasswordVisibility}"
                            />

            </Grid>

        </Border>

    </Border>
</Window>
